home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.UserControl Manabtn
- ClientHeight = 390
- ClientLeft = 0
- ClientTop = 0
- ClientWidth = 1275
- ScaleHeight = 390
- ScaleWidth = 1275
- ToolboxBitmap = "Manabtn.ctx":0000
- Begin VB.Timer timer
- Interval = 1
- Left = 1800
- Top = 1920
- End
- Begin VB.PictureBox btndn
- AutoSize = -1 'True
- BorderStyle = 0 'None
- Height = 375
- Left = 2400
- Picture = "Manabtn.ctx":0312
- ScaleHeight = 375
- ScaleWidth = 1260
- TabIndex = 2
- Top = 1920
- Width = 1260
- End
- Begin VB.PictureBox btnup
- AutoSize = -1 'True
- BorderStyle = 0 'None
- Height = 375
- Left = 2400
- Picture = "Manabtn.ctx":082C
- ScaleHeight = 375
- ScaleWidth = 1260
- TabIndex = 1
- Top = 1440
- Width = 1260
- End
- Begin VB.PictureBox btn
- AutoSize = -1 'True
- BorderStyle = 0 'None
- Height = 375
- Left = 0
- Picture = "Manabtn.ctx":0D0B
- ScaleHeight = 375
- ScaleWidth = 1260
- TabIndex = 0
- Top = 0
- Width = 1260
- Begin VB.Label lbl
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "Button"
- ForeColor = &H8000000D&
- Height = 195
- Left = 360
- TabIndex = 3
- Top = 120
- Width = 465
- End
- End
- End
- Attribute VB_Name = "Manabtn"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = True
- Attribute VB_PredeclaredId = False
- Attribute VB_Exposed = True
- 'Default Property Values:
- Const m_def_BackColor = 0
- Const m_def_BackStyle = 0
- Const m_def_BorderStyle = 0
- 'Property Variables:
- Dim m_BackColor As Long
- Dim m_BackStyle As Integer
- Dim m_BorderStyle As Integer
- 'Event Declarations:
- Event Click() 'MappingInfo=btn,btn,-1,Click
- Attribute Click.VB_Description = "Occurs when the user presses and then releases a mouse button over an object."
- Event DblClick()
- Attribute DblClick.VB_Description = "Occurs when the user presses and releases a mouse button and then presses and releases it again over an object."
- Event KeyDown(KeyCode As Integer, Shift As Integer)
- Attribute KeyDown.VB_Description = "Occurs when the user presses a key while an object has the focus."
- Event KeyPress(KeyAscii As Integer)
- Attribute KeyPress.VB_Description = "Occurs when the user presses and releases an ANSI key."
- Event KeyUp(KeyCode As Integer, Shift As Integer)
- Attribute KeyUp.VB_Description = "Occurs when the user releases a key while an object has the focus."
- Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
- Attribute MouseDown.VB_Description = "Occurs when the user presses the mouse button while an object has the focus."
- Event MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
- Attribute MouseMove.VB_Description = "Occurs when the user moves the mouse."
- Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
- Attribute MouseUp.VB_Description = "Occurs when the user releases the mouse button while an object has the focus."
-
-
-
- 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
- 'MemberInfo=8,0,0,0
- Public Property Get BackColor() As Long
- Attribute BackColor.VB_Description = "Returns/sets the background color used to display text and graphics in an object."
- BackColor = m_BackColor
- End Property
-
- Public Property Let BackColor(ByVal New_BackColor As Long)
- m_BackColor = New_BackColor
- PropertyChanged "BackColor"
- End Property
-
- 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
- 'MappingInfo=lbl,lbl,-1,ForeColor
- Public Property Get ForeColor() As OLE_COLOR
- Attribute ForeColor.VB_Description = "Returns/sets the foreground color used to display text and graphics in an object."
- ForeColor = lbl.ForeColor
- End Property
-
- Public Property Let ForeColor(ByVal New_ForeColor As OLE_COLOR)
- lbl.ForeColor() = New_ForeColor
- PropertyChanged "ForeColor"
- End Property
-
- 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
- 'MappingInfo=btn,btn,-1,Enabled
- Public Property Get Enabled() As Boolean
- Attribute Enabled.VB_Description = "Returns/sets a value that determines whether an object can respond to user-generated events."
- Enabled = btn.Enabled
- End Property
-
- Public Property Let Enabled(ByVal New_Enabled As Boolean)
- btn.Enabled() = New_Enabled
- PropertyChanged "Enabled"
- End Property
-
- 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
- 'MappingInfo=lbl,lbl,-1,Font
- Public Property Get Font() As Font
- Attribute Font.VB_Description = "Returns a Font object."
- Attribute Font.VB_UserMemId = -512
- Set Font = lbl.Font
- End Property
-
- Public Property Set Font(ByVal New_Font As Font)
- Set lbl.Font = New_Font
- PropertyChanged "Font"
- End Property
-
- 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
- 'MemberInfo=7,0,0,0
- Public Property Get BackStyle() As Integer
- Attribute BackStyle.VB_Description = "Indicates whether a Label or the background of a Shape is transparent or opaque."
- BackStyle = m_BackStyle
- End Property
-
- Public Property Let BackStyle(ByVal New_BackStyle As Integer)
- m_BackStyle = New_BackStyle
- PropertyChanged "BackStyle"
- End Property
-
- 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
- 'MemberInfo=7,0,0,0
- Public Property Get BorderStyle() As Integer
- Attribute BorderStyle.VB_Description = "Returns/sets the border style for an object."
- BorderStyle = m_BorderStyle
- End Property
-
- Public Property Let BorderStyle(ByVal New_BorderStyle As Integer)
- m_BorderStyle = New_BorderStyle
- PropertyChanged "BorderStyle"
- End Property
-
- 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
- 'MemberInfo=5
- Public Sub Refresh()
- Attribute Refresh.VB_Description = "Forces a complete repaint of a object."
- UserControl_Paint
- End Sub
-
- Private Sub btn_Click()
- RaiseEvent Click
- End Sub
-
- 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
- 'MappingInfo=lbl,lbl,-1,Caption
- Public Property Get Caption() As String
- Attribute Caption.VB_Description = "Returns/sets the text displayed in an object's title bar or below an object's icon."
- Caption = lbl.Caption
- lbl.Caption = Caption
- Centerlabel
- End Property
-
- Public Property Let Caption(ByVal New_Caption As String)
- lbl.Caption() = New_Caption
- PropertyChanged "Caption"
- End Property
-
- 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
- 'MappingInfo=btn,btn,-1,ToolTipText
- Public Property Get ToolTipText() As String
- Attribute ToolTipText.VB_Description = "Returns/sets the text displayed when the mouse is paused over the control."
- ToolTipText = btn.ToolTipText
- End Property
-
- Public Property Let ToolTipText(ByVal New_ToolTipText As String)
- btn.ToolTipText() = New_ToolTipText
- PropertyChanged "ToolTipText"
- End Property
-
- Private Sub btn_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
- btn.Picture = btndn.Picture
- End Sub
-
- Private Sub btn_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
- btn.Picture = btnup.Picture
- End Sub
-
- Private Sub lbl_Change()
- Centerlabel
- End Sub
-
- Private Sub lbl_Click()
- RaiseEvent Click
- End Sub
-
- Private Sub lbl_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
- btn.Picture = btndn.Picture
- End Sub
-
- Private Sub lbl_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
- btn.Picture = btnup.Picture
- End Sub
-
- Private Sub timer_Timer()
- If UnderMouse = True Then
- btn.BorderStyle = 1
- Else
- btn.BorderStyle = 0
- End If
- End Sub
-
- 'Initialize Properties for User Control
- Private Sub UserControl_InitProperties()
- m_BackColor = m_def_BackColor
- m_BackStyle = m_def_BackStyle
- m_BorderStyle = m_def_BorderStyle
- UserControl.Height = btn.Height
- UserControl.Width = btn.Width
- Centerlabel
- Runtime
- End Sub
-
- Private Sub UserControl_Paint()
- Centerlabel
- Runtime
- End Sub
-
- 'Load property values from storage
- Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
-
- m_BackColor = PropBag.ReadProperty("BackColor", m_def_BackColor)
- lbl.ForeColor = PropBag.ReadProperty("ForeColor", &H8000000D)
- btn.Enabled = PropBag.ReadProperty("Enabled", True)
- Set lbl.Font = PropBag.ReadProperty("Font", Ambient.Font)
- m_BackStyle = PropBag.ReadProperty("BackStyle", m_def_BackStyle)
- m_BorderStyle = PropBag.ReadProperty("BorderStyle", m_def_BorderStyle)
- lbl.Caption = PropBag.ReadProperty("Caption", "Button")
- btn.ToolTipText = PropBag.ReadProperty("ToolTipText", "")
- 'Centerlabel
- End Sub
-
- Private Sub UserControl_Resize()
- UserControl.Height = btn.Height
- UserControl.Width = btn.Width
- End Sub
-
- 'Write property values to storage
- Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
-
- Call PropBag.WriteProperty("BackColor", m_BackColor, m_def_BackColor)
- Call PropBag.WriteProperty("ForeColor", lbl.ForeColor, &H8000000D)
- Call PropBag.WriteProperty("Enabled", btn.Enabled, True)
- Call PropBag.WriteProperty("Font", lbl.Font, Ambient.Font)
- Call PropBag.WriteProperty("BackStyle", m_BackStyle, m_def_BackStyle)
- Call PropBag.WriteProperty("BorderStyle", m_BorderStyle, m_def_BorderStyle)
- Call PropBag.WriteProperty("Caption", lbl.Caption, "Button")
- Call PropBag.WriteProperty("ToolTipText", btn.ToolTipText, "")
- 'Centerlabel
- End Sub
-
- ' Functions and subroutines
- Private Function Centerlabel()
- lbl.Left = (btn.Width - lbl.Width) / 2
- lbl.Top = (btn.Height - lbl.Height) / 2
- End Function
- Private Function UnderMouse() As Boolean
- Dim ptMouse As POINTAPI
- GetCursorPos ptMouse
- If WindowFromPoint(ptMouse.X, ptMouse.Y) = btn.hWnd Then
- UnderMouse = True
- Else
- UnderMouse = False
- End If
- End Function
-
- Private Function Runtime()
- If Ambient.UserMode Then
- Timer.Enabled = True
- Else: Timer.Enabled = False
- End If
- End Function
-
-